package com.example.sellersale.controller;

import com.example.sellersale.entity.Goods;
import com.example.sellersale.server.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
public class GoodsController {
    @Autowired
    private GoodsService goodsService;
    /**
     * 实现商品信息展现功能====商品展示
     * @return
     */
    @GetMapping("/scan")
    public List<Goods> showGoods(){
        List<Goods> goods = goodsService.scanGoods();
        return goods;
    }
    /**
     * 增加库存
     * @param goods
     * @return
     */
    @PostMapping("/addGoods")
    public Boolean addGoods(Goods goods){
        return goodsService.addGoods(goods);
    }
}
